#pragma once


// CSocketTrackerWnd

#include "SocketTracker.h"
#include "MemDC.h"

class CSocketTrackerListCtrl : public CListCtrl
{

public:
	virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
private:
	DWORD m_uRelatedProcessID;
	VOID InitItemMemDC(CMemoryDC* dc, LPDRAWITEMSTRUCT lpDrawItemStruct);
	VOID GetItemDisplayText(CSocketTracker *pTracker, int nSubItem, LPTSTR lpStr, int nTextMax);
public:
	VOID SetRelatedProcessID(DWORD uProcessID);
	DWORD GetRelatedProcessID(void);
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	void UpdateItem(CSocketTracker *pTracker);
private:
	DWORD m_uClrHighlight;
	DWORD m_uClrNoHighlight;
	DWORD m_uClrHighlightText;
	DWORD m_uClrWindowText;
};

class CSocketTrackerWnd : public CDockablePane
{
	DECLARE_DYNAMIC(CSocketTrackerWnd)

public:
	CSocketTrackerWnd();
	virtual ~CSocketTrackerWnd();

protected:
	DECLARE_MESSAGE_MAP()
	CSocketTrackerListCtrl m_lvSocketTracker;
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	VOID UpdateListView(CList<CSocketTracker*,CSocketTracker*>* lstTracker, DWORD uProcessID);
	VOID SetRelatedProcessID(DWORD uProcessID);
	VOID AddSocketTracker(CSocketTracker* tracker);
	void UpdateItem(CSocketTracker *pTracker);
};


